<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>

<form  id ="formulario"action="<?php echo url_for('reservacion/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?idreservacion='.$form->getObject()->getIdreservacion() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
    <?php if (!$form->getObject()->isNew()): ?>
    <input type="hidden" name="sf_method" value="put" />
    <?php endif; ?>
    <?php if ($form->getObject()->isNew()) :?>
    <h1 > Nueva Reservacion </h1>
    <?php endif; ?>
    <?php if (!$form->getObject()->isNew()) :?>

    <script type="text/javascript">
        $(function() {
            $("#tabs").tabs();
        });
    </script>

    <div id="tabs">
        <ul>
            <li><a href="#tabs-2">Editar Status</a></li>
            <li><a href="#tabs-1">Editar Reservacion</a></li>
        </ul>
        <?php endif; ?>
        <table id="tabs-1" >
            <thead>

            </thead>
            <tfoot>
                <tr>

                    <td colspan="2">
                        &nbsp;

                        &nbsp;<input type="button" class="btn blue" id="botonVolver"
                                     onClick="location.href='<?php echo url_for('reservacion/index') ?>'" value="Volver"/>
                                     <?php if (!$form->getObject()->isNew()): ?>
                                         <?php

                                         echo " Monto: ".
                                                 $monto = Reservacion::montoReservacion($form->getObject()->
                                                 getIdreservacion())."BsF";
                                         ?>

                        &nbsp;<?php echo link_to('Eliminar', 'reservacion/delete?idreservacion='.$form->getObject()->getIdreservacion(),'class=btn red', array('method' => 'delete', 'confirm' => 'Esta seguro que quiere eliminar la pauta?')) ?>

                        <?php endif; ?>
                        <input class="btn green" type="submit" value="Confirmar" />
                    </td>

                </tr>
            </tfoot>
            <tbody>
                <?php echo $form ?>
            </tbody>

        </table>

        <?php if (!$form->getObject()->isNew()) :?>
        <div id='tabs-2'>
            <table  >
                <tfoot>
                    <tr>
                        <td colspan="3">
                            <input type="button" class="btn blue" id="botonVolver"
                                   onClick="location.href='<?php echo url_for('reservacion/index') ?>'" value="Volver"/>

                            <input class="btn green" type="submit" value="Confirmar" />
                        </td>
                    </tr>
                </tfoot>
                <tbody>
                    <tr>
                        <td>
                                <?php $reserva= ReservacionPeer::retrieveByPK($form->getObject()->getIdreservacion());
                                echo $form->setWidgets(array( 'status' => new sfWidgetFormChoice(array(
                                        'choices' => ReservacionPeer::getStatusChoices()))));
                            
                              // $reserva->setStatus( );

                                ?>
                        </td>
                    </tr>
                </tbody>
                <?php endif; ?>
            </table>
        </div>
</form>
